import React from 'react'
import styles from './index.module.scss'
import { NavBar } from 'antd-mobile'
import { withRouter } from 'react-router-dom'
import classNames from 'classnames'

function MyNavBar ({children,history,className,rightContent}) {
  return (
    <NavBar
      className={classNames(styles.navBar, className)}
      icon={<i className='iconfont icon-back'></i>}
      onLeftClick={()=> history.goBack()}
      rightContent={rightContent}>
        {/* MyNavBar的默认插件 */}
        {children}
    </NavBar>
  )
}
// 不是一级路由组件，拿不到history，必须高阶组件withRouter包一下
export default withRouter(MyNavBar)